package utildate;

import java.text.SimpleDateFormat;
import java.util.Date;

public class StringToDateDemo {

    public static void main(String[] args) {
        try {
            String s = "2020-01-01";

            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            Date d = sdf.parse(s);

            System.out.println(d);
        }catch(Exception ex){
            ex.printStackTrace();
        }
    }
}
